<div class='fui-page fui-page-current member-log-page'>
	<div class="fui-header">
        <div class="fui-header-left">
            <a class="back" ng-click='goback()'></a>
        </div>
        <div class="title">配送记录</div>
    </div>
    <div class='fui-content'>
		<div class="fui-tab fui-tab-success">
			<a ng-if="pagedata.pluginset.is_nosendtype1!=1" ng-class="{'active':pagedata.params.type==1}" class="external" href="javascript:;" ng-click="pagedata.params.type=1;tool.get_list('/order/list',true)">配送上门</a>
			<a ng-class="{'active':pagedata.params.type==2}" class="external" href="javascript:;" ng-click="pagedata.params.type=2;tool.get_list('/order/list',true)">自提点自助</a>
		</div>
		<div class="fui-tab fui-tab-success">
			<a ng-class="{'active':pagedata.params.status==1}" class="external" href="javascript:;" ng-click="pagedata.params.status=1;tool.get_list('/order/list',true)">进行中</a>
			<a ng-class="{'active':pagedata.params.status==2}" class="external" href="javascript:;" ng-click="pagedata.params.status=2;tool.get_list('/order/list',true)">已入库</a>
			<a ng-class="{'active':pagedata.params.status==3}" class="external" href="javascript:;" ng-click="pagedata.params.status=3;tool.get_list('/order/list',true)">已完成</a>
			<a ng-class="{'active':pagedata.params.status==4}" class="external" href="javascript:;" ng-click="pagedata.params.status=4;tool.get_list('/order/list',true)">异常单</a>
		</div>
		<div class="fui-cellone" style="padding-right:0.4rem;z-index: 108;top:0;background:#fff">
			 <div class="fui-cellone-info">
				<div class="search-input" style="height:1.6rem">
					<form action="javascript:return true">
					<i id="searchsub" class="icon icon-sousuo1 bold" ng-click="tool.get_list('jy_area_dian/order/list/',true)" style="line-height: 1.7rem;"></i>
					<input type="search" placeholder="输入手机号搜索" class="search" ng-model="pagedata.params.mobile" style="height:1.6rem;text-align: left; color: #999;border: 0 solid #ddd; font-size:0.6rem;background:#f9f9f9;border-radius: 1rem;" />
					</form>
				</div>
			 </div>
			 <div class="fui-cellone-remark noremark">
			 	<span style="margin-left:0.3rem;font-size: 0.75rem;" ng-click="tool.get_list('jy_area_dian/order/list/',true)">搜索</span>
			 </div>
		</div>
		<div style="padding:0 0.5rem">
		 <div class='content-empty' ng-show="!pagedata.list || pagedata.list.length<=0">
            <i class='fa fa-comment-o'></i><br/>暂时没有任何配送单!
        </div>
        <div ng-repeat="item in pagedata.list" class='fui-cell-group' ng-show="pagedata.list.length>0" >
			<div class="fui-cell">
				<div class="fui-cell-info">
					<div class='title'>
						<span ng-show="item.sendtype==1" class="label label-success">配送上门</span> 
						<span ng-show="item.sendtype!=1" class="label label-danger">自提点自助</span>
						<span>({{item.week}})</span>
						<span ng-if="item.commission_money>0" class="red" style="font-size:0.65rem">
							分红:￥{{item.commission_money}}
						</span>
					</div>
				</div>
				<div class='fui-cell-remark noremark'>
					<span class='fui-label fui-label-default gray' style="background:#f2f2f2;border-radius:0.2rem;">{{item.statustitle}}</span>
				</div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-text">
					<div class="gray">订单号: {{item.ordersn}}</div>
					<div class="gray">{{item.sendtype==2?'自提':'配送'}}时间：{{item.selfinfo.selftime}}</div>
					<div ng-if="item.times.length>0" class="fui-cellone" style="padding:0.2rem 0 0">
							<div class="fui-cellone-info">
								<div class="fui-icon-group noborder col-3" style="padding:0 0.15rem">
									<div class="fui-icon-col" ng-repeat="v in item.times" style="margin:0">
										<label class="jyui_cell_col">
											<div class="btn btn-gray" style="font-size: 0.6rem;background:#f2f2f2;margin: 0.1rem;line-height:2">{{v}}</div>
										</label>
									</div>
								</div>
							</div>
					</div>
					<div style="line-height:1.4;color:#999;font-size:0.65rem"><i class="icon icon-wo1"></i> 联系人： <span class="text-danger">{{item.address.realname || item.address.name}}  </span> 联系电话： <a href="tel:{{item.address.mobile}}" class="text-danger">{{item.address.mobile}}</a></div>
					<div ng-if="pagedata.params.type==1" style="line-height:1.4;color:#999;font-size:0.65rem"><i class="icon icon-ditu"></i>  配送地址： <span class="text-danger">{{item.addressinfo}} </span> <a href="javascript:" ng-click="pagedata.openLocation(item.address);" style="font-size:0.65rem;line-height: 1.5;color:red"><i class="icon icon-lvyoutehui"></i>导航</a></div>
				</div>
			</div>
			<div class="fui-cellone" ng-repeat="g in item.goods" ng-if="g.total>0" style="padding:0.3rem 0.5rem">
							<div class="fui-cellone-label" style="width:2.3rem">
								<img style="width:2rem;height:2rem" ng-src="{{tomedia(g.image) || '../core/resource/images/nopic.jpg'}}">
							</div>
							<div class="fui-cellone-info">
								<div>{{g.title}}</div>
								<div ng-if="g.selespename" style="color:red">
									{{g.selespename}}
								</div>
								<div ng-if="g.leititle" style="color:red">
									{{g.leititle}}
								</div>
							</div>
							<div class="fui-cellone-remark noremark">
								{{g.total}}{{g.unit}}
							</div>
			</div>
			<div class="right" style="padding:0.3rem 0.5rem">
				<span ng-if="item.status==1 && item.type==1">
					<div class="btn btn-sm btn-success-o order-finish" style="font-size:0.7rem" href="javascript:" ng-click="post({},'/order/tostatus15/id='+item.id);">接单上门</div>
				</span>
				<span ng-if="item.status==2">
					<div class="btn btn-sm btn-success-o order-finish" style="font-size:0.7rem" href="javascript:" ng-click="post({},'/order/tostatus3/id='+item.id);">客户已取货</div>
				</span>
				<span ng-if="item.status==15">
					<div class="btn btn-sm btn-success-o order-finish" style="font-size:0.7rem" href="javascript:" ng-click="post({},'/order/tostatus17/id='+item.id);">上门取货成功</div>
				</span>
				<span ng-if="item.status==16">
					<div class="btn btn-sm btn-success-o order-finish" style="font-size:0.7rem" href="javascript:" ng-click="post({},'/order/tostatus17/id='+item.id);">确认收到货</div>
				</span>
				<span ng-if="item.status==17 && item.type==1">
					<div class="btn btn-sm btn-success-o order-finish" style="font-size:0.7rem" href="javascript:" ng-click="post({},'/order/tostatus18/id='+item.id);">已送货到平台</div>
				</span>
				<span ng-if="pagedata.pluginset.is_zhuan==1 && (item.status==15 || item.status==1)">
					<div class="btn btn-sm btn-success-o order-finish" style="font-size:0.7rem" href="javascript:" ng-click="post({},'/order/tostatus14/id='+item.id);">转单给平台</div>
				</span>
				<span class="t-r" ng-if="item.selfinfo.number2" ><i class="icon icon-peisong" style="font-size: 0.65rem"> 取货号：<span class="price bold">{{item.selfinfo.number2}}</span></i></span>
			</div>
			</div>
		</div>
    </div>
</div>
<div ng-include="sys_html('_footer')"></div>
<script>
scope.loading = true;  //状态标记
scope.isnodata = false;
//滚动加载
scope.tool.get_list('jy_area_dian/order/list/',true);
scope.pagedata.scroll_bottom=function(){
	scope.tool.get_list('jy_area_dian/order/list/');
}
scope.pagedata.openLocation=function(item){
	var pcdaddress= item.pcd?item.pcd.province+item.pcd.city+item.pcd.district+item.pcd.street:'';
	var post={
		'address':pcdaddress+item.address,
		'city':item.pcd?item.pcd.city:''
	}
	scope.tool.get_latlng(post,function(res){
		var lat_lng = res.location
		var address_components = res.address_components
		wx.openLocation({
			latitude: lat_lng.lat, // 纬度，浮点数，范围为90 ~ -90
			longitude: lat_lng.lng, // 经度，浮点数，范围为180 ~ -180。
			name: pcdaddress, // 位置名
			address: item.address, // 地址详情说明
			scale: 20, // 地图缩放级别,整形值,范围从1~28。默认为最大
			infoUrl: '', // 在查看位置界面底部显示的超链接,可点击跳转
			success:function(){
				//alert(1111);
			},
			fail:function(res){
				scope.message('导航异常，可能是权限问题：'+res.errMsg);
			}
		});
	});
}
</script>